import Mixins from '@/views/mixins'
import finance from '@/api/eims/financeAPI'
export default {
  mixins: [Mixins],
  created () {
    this.initPageList()
  },
  mounted () {
    this.$store.dispatch('common/RefreshDic', 'paymentType')
  },
  methods: {
    getRequestType (opt) {
      if (this.id === 'receivable') {
        if (opt === 'saveReceivableInfo') {
          return finance.saveReceivableInfoAPI
        } else if (opt === 'updateReceivableInfo') {
          return finance.updateReceivableInfoAPI
        } else if (opt === 'deleteReceivableInfo') {
          return finance.deleteReceivableInfoAPI
        } else {
          return finance.getReceivableInfoListAPI
        }
      } else if (this.id === 'payable') {
        if (opt === 'savePayableInfo') {
          return finance.savePayableInfoAPI
        } else if (opt === 'updatePayableInfo') {
          return finance.updatePayableInfoAPI
        } else if (opt === 'deletePayableInfo') {
          return finance.deletePayableInfoAPI
        } else {
          return finance.getPayableInfoListAPI
        }
      }
    }
  }
}
